#ifndef GOBANG_H
#define GOBANG_H

#include <QtGui/QMainWindow>
#include <QString>
#include "ui_gobang.h"
#include "Const.h"

class QLabel;
class GameEngine;
class QGraphicsEllipseItem;

class Gobang : public QMainWindow
{
	Q_OBJECT

public:
	Gobang(QWidget *parent = 0, Qt::WFlags flags = 0);

    ~Gobang();

private slots:
	void newGame();
	void setOptions();
    void saveRecord();
    void loadRecord();
    void displayAIChess(int row, int line, GB::CHESS_TYPE type);
    void changeLog(bool enable);

private:
	void mousePressEvent(QMouseEvent *event);
	void placeChess(QPixmap *pixMap, int row, int line);
	void displayResult(GB::GAME_RESULT res);
	void displayEval(GB::CHESS_TYPE type);
    void InitCurrentChessFlag();
    void displayRowLineNumber();
    void InitChessBoard();
    void clearRecord();

	Ui::GobangClass ui;

	QGraphicsScene *scene;
	QGraphicsView  *view;

	QPixmap *blackPixmap;
	QPixmap *whitePixmap;

    QGraphicsEllipseItem *currChessFlag;

	// status bar
	QLabel *statusLabel;
	QLabel *evalLabel;

	// Game Engine
	GameEngine *game;

    // saved title
    QString title;

    // Game record
    QString recordFileName;
};

#endif // GOBANG_H
